var AddThis_UrlBar = {
    
    init : function() {
        AddThis_Util.dbg("UrlBar.init: initting...");
        var hide = AddThis_Util.getBooleanPref('extensions.addthis.urlbar.disable', false);
        AddThis_UrlBar.setVisibility(!hide);
        AddThis_Util.dbg("UrlBar.init: done.");
    },
    
    isVisible : function(doc) {
        if (typeof doc == "undefined") doc = document;
        var visible = !doc.getElementById("at_urlbarBtn").hidden;
        AddThis_Util.dbg("UrlBar.isVisible: " + visible);
        return visible;
    },

    prepare: function()
    {
        AddThis_Util.dbg("UrlBar.prepare: go...");
        AddThis_Sharing.initShareMenu("at_urlbarBtnPopup");
        AddThis_Util.dbg("UrlBar.prepare: done");
    },
	
    setVisibility : function(visible, doc) {
        if (typeof doc == "undefined") doc = document;
        AddThis_Util.dbg("UrlBar.setVisibility: " + visible);
        var btn = doc.getElementById("at_urlbarBtn");
        btn.hidden = !visible;
        AddThis_Util.dbg("UrlBar.setVisibility: hidden now = " + btn.hidden);
    }
};